<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    var num1 = 123;
    var num2 = 245;

    // 三元运算符
    var result = num1 > num2 ? num1 : num2;
    console.log(result);


    // 给变量一个默认值
    var info = {
      name: 'zhangsan'
    }

    var obj = info ? info : {}
    console.log(obj)


    // 判断是否是成年
    var age = prompt('请输入年龄')
    var result = age >= 18 ? '是成年人' : '不是成年人'
    console.log(result);
  </script>
</body>

</html>